//index.js
//获取应用实例
const app = getApp()
var util = require('../../utils/util.js');
Page({
  data: {
    kapian:[
      {
        biaoti:"不一样的古风头饰",
         biaoqian1:"摄影",
        biaoqian2:"原创",
        liulanshu:0,
        dianzanshu:0,
        id:0
      },
      {
        biaoti:"不一样的古风头饰",
         biaoqian1:"摄影",
        biaoqian2:"原创",
        liulanshu:0,
        dianzanshu:0,
        id:1
      },
      {
        biaoti:"不一样的古风头饰",
         biaoqian1:"摄影",
        biaoqian2:"原创",
        liulanshu:0,
        dianzanshu:0,
        id:2
      },
      {
        biaoti:"不一样的古风头饰",
         biaoqian1:"摄影",
        biaoqian2:"原创",
        liulanshu:0,
        dianzanshu:0,
        id:3
      }
    ],
    tupian:"https://7975-yunkaifa-17866631279-1302253453.tcb.qcloud.la/65.JPG?sign=184568dd1bccbefbbdc3a523405ee569&t=1593692112"
  },
  
  kapianchufa:function(event){
    // var that = this
    var id = event.currentTarget.dataset.id
    console.log(event.currentTarget.dataset.id) 
    this.setData({
      // 对应卡片浏览数的增加
      [`kapian[${id}].liulanshu`]:this.data.kapian[id].liulanshu+1,
      // 'kapian[1].liulanshu':this.data.kapian[id].liulanshu+1
      
    })
    // this.data.kapian[id].liulanshu=this.data.kapian[id].liulanshu

  },
  onLoad: function () {
    // 调用函数时，传入new Date()参数，返回值是日期和时间
    var time = util.formatTime(new Date());
    // 再通过setData更改Page()里面的data，动态更新页面的数据
    this.setData({
      time: time
    });
  }
})
